from sqlalchemy import create_engine, engine
from sqlalchemy.orm import sessionmaker


class DBStore:
    def __init__(self):
        # 初始化数据库连接:
        self.engine = create_engine('sqlite:///test.db', echo=True)
        self.conn = self.engine.connect()

    def get_session(self):
        # 创建DBSession类型:
        self.session = sessionmaker(bind=self.engine)()
        return self.session

    def create_table(self, Base):
        Base.metadata.create_all(self.engine)

    def close_db(self):
        self.session.close_all()


class ExcelStore(object):
    def __init__(self, *args):
        super(ExcelStore, self).__init__(*args)
